/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jmooc.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author Group
 */
@Entity
public class Course implements Serializable {
private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private Long duration;
    private String certificationName;

    @OneToMany @LazyCollection(LazyCollectionOption.FALSE)@JoinColumn
    private List<CourseModule> courseModules;
    
    @OneToMany @LazyCollection(LazyCollectionOption.FALSE) @JoinColumn
    private List<ReadCourse> readCourses;
    
    @OneToMany (mappedBy = "course") @LazyCollection(LazyCollectionOption.FALSE) 
    private List<Question> questions;

    public List<Question> getQuestions() {
        return questions;
    }

    public void setQuestions(List<Question> questions) {
        this.questions = questions;
    }
    
    public String getCertificationName() {
        return certificationName;
    }

    public void setCertificationName(String certificationName) {
        this.certificationName = certificationName;
    }

    public List<ReadCourse> getReadCourses() {
        return readCourses;
    }

    public void setReadCourses(List<ReadCourse> readCourses) {
        this.readCourses = readCourses;
    }
    
    public List<CourseModule> getCourseModules() {
        return courseModules;
    }

    public void setCourseModules(List<CourseModule> courseModules) {
        this.courseModules = courseModules;
    }

    public Long getDuration() {
        return duration;
    }

    public void setDuration(Long duration) {
        this.duration = duration;
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    
}

/*
 * 
 * /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.

@Entity
public class Course implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private Long duration;
    private String certificationName;

    @OneToMany @JoinColumn
    private List<CourseModule> courseModules;
    
    @OneToMany @JoinColumn
    private List<ReadCourse> readCourses;
    
    @OneToMany @JoinColumn
    private List<Question> questions;

    public List<Question> getQuestions() {
        return questions;
    }

    public void setQuestions(List<Question> questions) {
        this.questions = questions;
    }
    
    public String getCertificationName() {
        return certificationName;
    }

    public void setCertificationName(String certificationName) {
        this.certificationName = certificationName;
    }

    public List<ReadCourse> getReadCourses() {
        return readCourses;
    }

    public void setReadCourses(List<ReadCourse> readCourses) {
        this.readCourses = readCourses;
    }
    

    public List<CourseModule> getCourseModules() {
        return courseModules;
    }

    public void setCourseModules(List<CourseModule> courseModules) {
        this.courseModules = courseModules;
    }

    public Long getDuration() {
        return duration;
    }

    public void setDuration(Long duration) {
        this.duration = duration;
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Course)) {
            return false;
        }
        Course other = (Course) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jmooc.entity.Course[ id=" + id + " ]";
    }
    
}

 */